import { $http } from './index';
import axios from 'axios';

export function loadCommonParams(data = {}) {
    // 门禁类型子类型
    // return $http.get(`/saas/common/loadCommonParams?paramKey=${paramKey}`, data);
    return $http.post('/saas/common/loadCommonParams', data);
}

// 获取行政区域
export function loadRegionCodes() {
    return $http.get('/saas/common/loadRegionCodes');
}

// 获取供应商区域列表
export const getSupplierAreaList = () => {
    return $http.get('/saas/common/getAuthArea');
};
export const getUser = () => {
    return $http.get('/saas/common/user/info');
};

// 自定义
export const customHttp = (param: any) => {
    const { url, method, data, headers } = param;
    return axios({
        url: url,
        method: method,
        data: data,
        headers,
    });
};

export default {
    loadCommonParams,
    loadRegionCodes,
    getSupplierAreaList,
    getUser,
    customHttp,
};
